<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%@ taglib prefix="sj" uri="/struts-jquery-tags"%>
<%@ taglib prefix="sjr" uri="/struts-jquery-richtext-tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd" >
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="pragma" content="no-cache" />
	<meta http-equiv="cache-control" content="no-cache" />
	<meta http-equiv="expires" content="0" />  
	<script  language="JavaScript" type="text/javascript" >
	   	
	    
	    $.subscribe('validarX', function(event,data) {
	        var fData = event.originalEvent.formData;
	           //alert('About to submit: \n\n' + fData[0].value + ' to target '+event.originalEvent.options.target+' with timeout '+event.originalEvent.options.timeout );
	       // var form = event.originalEvent.form[0];
	       var ok=true;
	            var valx1=document.getElementById('destinatario').value;
		    	if(valx1==''){
		    		alert('Debe indicar el destinatario');
		    		ok = false;
		    	}
		    	var valx=document.getElementById('archivo1').value;
		    	if(valx==''){
		    		alert('Debe seleccionar el archivo con la propuesta');
		    		ok = false;
		    	}
		    	if(ok==false)
	               event.originalEvent.options.submit = false;
	      });
	    
	</script>
</head>

<body>
<div><img id='progreso_gd' src='images/ajax-loader.gif' alt='Guardando...' style='display: none' /></div>
<sj:div  id='resultado_act_XWE522224444'>
<s:actionmessage theme="jquery" /> <s:actionerror theme="jquery" /> 
	<s:form action="guardar_propuesta.action" id="form_crearact232323232tt" name="form_crearact232323232tt" theme="simple" method="post" enctype="multipart/form-data"  >
	<s:set name="n_codigo">
		<s:property value="cod_prospecto" />
	</s:set>
	<s:set name="n_email">
		<s:property value="destinatario" />
	</s:set>
	<s:hidden name='cod_prospecto' value='%{n_codigo}'></s:hidden>
	  
		<s:url id="car_pro1" value="cargar_lista_propuesta.action"  >
			   <s:param name='cod_prospecto' value='%{n_codigo}' ></s:param>
		</s:url>
		
	
	<table width="100%">
		<tr>
			<td colspan='6'>
				<sj:div id='cargar_items_propuesta' href="%{car_pro1}" indicator="progreso_gd" >	
	            </sj:div>
			</td>
		</tr>
	    <tr>
	       <td colspan='6' >
	       <table >
	            <tr>
					<td width="20%" >
					  <table > 
					       <tr>
					          <td width="10%">Destinatario(s):</td>
							  <td width="30%" ><s:textfield  cssClass='caja_3' size='45' name="destinatario" id="destinatario" value='%{n_email}' ></s:textfield> </td>
							  <td width="10%">Propuesta:</td>
							  <td width="20%" ><s:file cssClass='caja_3' size='30' name="archivo"  id='archivo1' /></td>
						  </tr>		
						</table>
					</td>
			    </tr>	
			</table>
		  </td>
		</tr>
		<tr>
			<td width="100%" colspan='6'>
				    <sjr:tinymce 
						id="mensaje" 
						name="mensaje" 
						rows="10" 
						cols="80" 
						width="850"
						height="200"
						uploads="true"
						onFocusTopics="focusRichtext"
						onBlurTopics="blurRichtext"
						onChangeTopics="highlightRichtext"
						value=""
						dataType="html"
						toolbarAlign="left"
                        toolbarLocation="top"
                        plugins="safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template"
						editorLocal="es"
						editorTheme="advanced"
						editorSkin="o2k7"
						toolbarButtonsRow1="newdocument,preview,fullscreen,print,|,undo,redo,cut,copy,paste,pastetext,|,search,replace,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,fontselect,fontsizeselect"
                        toolbarButtonsRow2="bullist,numlist,|,outdent,indent,blockquote,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,|,forecolor,backcolor"
                        toolbarButtonsRow3="tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,iespell,media,advhr,|,ltr,rtl,"
                        toolbarButtonsRow4=""

					/>
					
					
			</td>	
		</tr>
		<tr>
			<td colspan='4' align='center' >
			    <img id="indicator_propuestabb_bbbp1" src="images/ajax-loader3.gif" alt="Cargando..." style="display: none" /> 
				<sj:submit id='btn_enviarpropuesta' cssClass="boton_sia" targets="resultado_act_XWE522224444" indicator="indicator_propuestabb_bbbp1" button="true" value="Enviar propuesta"  onBeforeTopics="validarX"  />
				
			</td>
		</tr>
	</table>
</s:form></sj:div>
</body>
</html>